package edu.pku.sei.mte.transformation;

import edu.pku.sei.mte.compositetrans.condition.CheckConditionVisitor;
import edu.pku.sei.mte.runtime.rulebased.RBTContext;
import edu.pku.sei.mte.runtime.rulebased.RBTEnvironment;
import edu.pku.sei.mte.transformation.expression.CheckOnlyExpressionVisitor;
import edu.pku.sei.mte.transformation.expression.EnforceExpressionVisitor;
import edu.pku.sei.mte.transformation.gt.GTEnforceVisitor;
import edu.pku.sei.mte.transformation.qvt.QVTCheckAllVisitor;
import edu.pku.sei.mte.transformation.qvt.QVTCheckOnlyVisitor;
import edu.pku.sei.mte.transformation.qvt.QVTCheckPartVisitor;
import edu.pku.sei.mte.transformation.qvt.QVTCheckResultVisitor;
import edu.pku.sei.mte.transformation.qvt.QVTEnforceVisitor;

public class VisitorFactory {
	
	public static VisitorFactory INSTANCE = new VisitorFactory();
	
	private VisitorFactory(){}
	
	public ModelTransformationVisitor getModelTransformationVisitor(String semantic, String mode, RBTEnvironment env){
		if(semantic.equals("gt")){
			return getGTEnforceVisitor(env);
		}else{
			if(mode.equalsIgnoreCase("qvt_enforce"))
				return getQVTEnforceVisitor(env);
			else return getQVTCheckOnlyVisitor(env);
		}
	}
	
	public CheckOnlyExpressionVisitor getCheckOnlyExpressionVisitor(RBTContext context){
		return new CheckOnlyExpressionVisitor(context);
	}
	
	public EnforceExpressionVisitor getEnforceExpressionVisitor(RBTContext context){
		return new EnforceExpressionVisitor(context);
	}
	
	public CheckOnlyExpressionVisitor getCheckOnlyExpressionVisitor(RBTContext context, Object expectedValue){
		return new CheckOnlyExpressionVisitor(context, expectedValue);
	}
	
	public EnforceExpressionVisitor getEnforceExpressionVisitor(RBTContext context, Object expectedValue){
		return new EnforceExpressionVisitor(context, expectedValue);
	}
	
	public QVTCheckOnlyVisitor getQVTCheckOnlyVisitor(RBTEnvironment env){
		return new QVTCheckOnlyVisitor(env);
	}
	
	public QVTEnforceVisitor getQVTEnforceVisitor(RBTEnvironment env){
		return new QVTEnforceVisitor(env);
	}
	
	public QVTCheckResultVisitor getQVTCheckResultVisitor(RBTEnvironment env){
		return new QVTCheckResultVisitor(env);
	}
	
	public QVTCheckPartVisitor getQVTCheckPartVisitor(RBTEnvironment env){
		return new QVTCheckPartVisitor(env);
	}
	
	public QVTCheckAllVisitor getQVTCheckAllVisitor(RBTEnvironment env){
		return new QVTCheckAllVisitor(env);
	}
	
	public GTEnforceVisitor getGTEnforceVisitor(RBTEnvironment env){
		return new GTEnforceVisitor(env);
	}
	
	public CheckConditionVisitor getCheckConditionVisitor(RBTEnvironment env){
		return new CheckConditionVisitor(env);
	}
}
